package com.sina.weibo;

import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.IBinder;
import android.os.SystemClock;
import android.provider.MediaStore.Images.Media;
import android.text.Editable;
import android.text.SpannableString;
import android.text.TextWatcher;
import android.view.Display;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.TextView.BufferType;
import android.widget.Toast;
import com.sina.weibo.models.User;
import com.sina.weibo.view.EmotionView;
import com.sina.weibo.view.EmotionView.EmotionAdapter;
import java.io.File;
import java.io.FileOutputStream;
import sudroid.android.FileUtil;

public class EditActivity extends BaseActivity
  implements TextWatcher
{
  static final int DIALOG_ALERT_DETELE_ALL_TEXT = 1010;
  static final int DIALOG_ALERT_DRAFT_CONFIRM = 1007;
  static final int DIALOG_ALERT_IMPORT = 1001;
  static final int DIALOG_ALERT_IMPORT_DELETE = 1002;
  static final int DIALOG_ALERT_JUMP_TO_SETTING = 1000;
  static final int DIALOG_ALERT_LOAD_DRAFT_CACHE = 1009;
  static final int DIALOG_ALERT_OVERRIDE_DRAFT = 1008;
  static final int DIALOG_PROGRESS_FORWARD_MBLOG = 1005;
  static final int DIALOG_PROGRESS_POST_COMMENT = 1004;
  static final int DIALOG_PROGRESS_POST_MBLOG = 1003;
  static final int DIALOG_PROGRESS_POST_PRIVATE_MESSAGE = 1006;
  public static final String EXTRA_COMMENT_AUTHOR_UID = "com.sina.weibo.intent.extra.COMMENT_AUTHOR_UID";
  public static final String EXTRA_COMMENT_ID = "com.sina.weibo.intent.extra.COMMENT_ID";
  public static final String EXTRA_FORWARD_REASON = "com.sina.weibo.intent.extra.FORWARD_REASON";
  public static final String EXTRA_INIT_TEXT = "com.sina.weibo.intent.extra.INIT_TEXT";
  public static final String EXTRA_LAUCH_MODE = "com.sina.weibo.intent.extra.LAUCH_MODE";
  public static final String EXTRA_MBLOG_AUTHOR_UID = "com.sina.weibo.intent.extra.MBLOG_AUTHOR_UID";
  public static final String EXTRA_MBLOG_ID = "com.sina.weibo.intent.extra.MBLOG_ID";
  public static final String EXTRA_NICKNAME = "com.sina.weibo.intent.extra.NICKNAME";
  private static final int REQUEST_CODE_CAMERA = 101;
  private static final int REQUEST_CODE_GALLERY = 100;
  protected static final int REQUEST_CODE_IMAGE_EDIT = 102;
  private String DEFAULT_DRAFT_TEXT_PATH;
  private int MAX_TEXT_LENGTH = 140;
  CheckBox cbCommentSameTime;
  EditText etMblog;
  ImageButton ibFace;
  private ImageButton ibInsertLocation;
  private ImageButton ibInsertPic;
  ImageView insertLocationView;
  ImageView insertPicView;
  private View llOperationExtraLayout;
  private AtEditHelper mAtEditHelper;
  private EmotionView.EmotionAdapter mEmotionAdapter;
  EmotionView mEmotionView;
  private FaceClickHealper mFaceClickHealper;
  private ImageLoadingHelper mImageLoadingHelper;
  InputMethodManager mInputMethodManager;
  private LauchMode mLauchMode;
  private LocationHelper mLocationHelper;
  private PostContentHelper mPostContentHelper;
  private TopicHelper mTopicHelper;
  ProgressBar pgLoadingLocation;
  private File sdcardTempFile;
  TextView tvTextLimit;
  boolean usingDraft;

  public EditActivity()
  {
    EditActivity.1 local1 = new EditActivity.1(this);
    this.mEmotionAdapter = local1;
    this.usingDraft = 0;
  }

  private void actionBeforeDestroy()
  {
    Utils.logd("\tactionBeforeDestroy()");
    if ((this.mImageLoadingHelper.hasBitmap()) || (!android.text.TextUtils.isEmpty(this.etMblog.getText().toString())) || (this.mLocationHelper.isLocatedSucess()))
    {
      LauchMode localLauchMode1 = this.mLauchMode;
      LauchMode localLauchMode2 = LauchMode.NEW_BLOG;
      if (localLauchMode1 == localLauchMode2)
      {
        if ((!doesDraftExist()) || (!equalDraft()))
          break label76;
        finish();
      }
    }
    while (true)
    {
      return;
      label76: showDialog(1007);
      continue;
      Utils.logd("\t不需要处理草稿逻辑");
      finish();
    }
  }

  private boolean checkTextLimit()
  {
    if (this.mPostContentHelper.getCurrentTextLength() >= 0);
    for (int i = 1; ; i = 0)
      return i;
  }

  private boolean deleteDraft()
  {
    boolean bool1 = deleteTextDraft();
    boolean bool2 = this.mImageLoadingHelper.deleteDraft();
    boolean bool3 = bool1 & bool2;
    boolean bool4 = this.mLocationHelper.deleteDraft();
    return bool3 & bool4;
  }

  private void deleteSDCardTempFile()
  {
    boolean bool = FileUtil.deleteDependon(this.sdcardTempFile);
    this.insertPicView.setImageBitmap(null);
    this.insertPicView.setVisibility(8);
    this.mImageLoadingHelper.reset();
  }

  private boolean deleteTextDraft()
  {
    Utils.logd("删除文字缓存");
    return FileUtil.deleteDependon(this.DEFAULT_DRAFT_TEXT_PATH);
  }

  private void dismissDialogs()
  {
    if (!isFinishing())
    {
      int[] arrayOfInt = $SWITCH_TABLE$com$sina$weibo$EditActivity$LauchMode();
      int i = this.mLauchMode.ordinal();
      switch (arrayOfInt[i])
      {
      default:
      case 1:
      case 2:
      case 3:
      case 8:
      case 9:
      case 5:
      case 6:
      case 4:
      case 7:
      }
    }
    while (true)
    {
      return;
      dismissDialog(1003);
      continue;
      dismissDialog(1004);
      continue;
      dismissDialog(1005);
      continue;
      dismissDialog(1006);
    }
  }

  private void displayImageUri(Uri paramUri)
  {
    this.mImageLoadingHelper.importBitmapFile(paramUri);
    if (!this.mImageLoadingHelper.hasBitmap())
      Toast.makeText(this, 2131427531, 0).show();
    while (true)
    {
      return;
      displayInsertBitmap();
    }
  }

  private boolean doesDraftExist()
  {
    if ((!doesTextDraftExist()) && (!this.mImageLoadingHelper.doesDraftExist()) && (!this.mLocationHelper.doesDraftExist()));
    for (int i = 0; ; i = 1)
      return i;
  }

  private boolean doesTextDraftExist()
  {
    return FileUtil.doesExisted(this.DEFAULT_DRAFT_TEXT_PATH);
  }

  private boolean equalDraft()
  {
    if (((!this.mImageLoadingHelper.doesDraftExist()) || (this.mImageLoadingHelper.equalDraft())) && ((!this.mLocationHelper.doesDraftExist()) || (this.mLocationHelper.equalDraft())) && ((!doesTextDraftExist()) || (equalTextDraft())));
    for (int i = 1; ; i = 0)
      return i;
  }

  private boolean equalTextDraft()
  {
    try
    {
      if (doesTextDraftExist())
      {
        String str1 = (String)FileUtil.loadObject(this.DEFAULT_DRAFT_TEXT_PATH);
        String str2 = this.etMblog.getText().toString();
        boolean bool1 = str1.equals(str2);
        bool2 = bool1;
        return bool2;
      }
    }
    catch (Exception localException)
    {
      while (true)
      {
        Utils.loge(localException);
        boolean bool2 = false;
      }
    }
  }

  private void initCommentCommentLogic()
  {
    initComments();
    verifyCommentCommentIntent();
  }

  private void initComments()
  {
    this.llOperationExtraLayout.setVisibility(0);
    this.ibInsertPic.setVisibility(8);
    this.ibInsertLocation.setVisibility(8);
    ((TextView)findViewById(2131624078)).setText(2131427735);
  }

  private void initFeedbackLogic()
  {
  }

  private void initForwardLogic()
  {
    this.llOperationExtraLayout.setVisibility(0);
    this.ibInsertPic.setVisibility(8);
    this.ibInsertLocation.setVisibility(8);
    ((TextView)findViewById(2131624078)).setText(2131427734);
    verifyForwardIntent();
    Intent localIntent = getIntent();
    String str1 = localIntent.getStringExtra("com.sina.weibo.intent.extra.FORWARD_REASON");
    if (!android.text.TextUtils.isEmpty(str1))
    {
      StringBuilder localStringBuilder1 = new StringBuilder();
      StringBuilder localStringBuilder2 = localStringBuilder1.append(" //@");
      String str2 = localIntent.getStringExtra("com.sina.weibo.intent.extra.NICKNAME");
      StringBuilder localStringBuilder3 = localStringBuilder1.append(str2);
      StringBuilder localStringBuilder4 = localStringBuilder1.append(":");
      StringBuilder localStringBuilder5 = localStringBuilder1.append(str1);
      String str3 = localStringBuilder1.toString();
      setEditText(str3);
      this.etMblog.setSelection(0, 1);
    }
  }

  private void initPrivateMessageLogic()
  {
    this.llOperationExtraLayout.setVisibility(8);
    this.ibInsertPic.setVisibility(8);
    this.ibInsertLocation.setVisibility(8);
    this.MAX_TEXT_LENGTH = 300;
    TextView localTextView = this.tvTextLimit;
    String str = String.valueOf(this.MAX_TEXT_LENGTH);
    localTextView.setText(str);
    verifyPrivateMessageIntent();
  }

  private void initSimpleCommentLogic()
  {
    initComments();
    verifySimpleCommentIntent();
  }

  private void loadDraft()
  {
    this.usingDraft = 1;
    if (this.mImageLoadingHelper.doesDraftExist())
      this.mImageLoadingHelper.loadDraft();
    if (this.mLocationHelper.doesDraftExist())
      this.mLocationHelper.loadDraft();
    if (doesTextDraftExist())
      loadTextDraft();
  }

  private void loadTextDraft()
  {
    try
    {
      String str = (String)FileUtil.loadObject(this.DEFAULT_DRAFT_TEXT_PATH);
      setEditText(str);
      Utils.logd("\t 读取文字内容缓存成功\n" + str);
      return;
    }
    catch (Exception localException)
    {
      while (true)
        Utils.loge(localException);
    }
  }

  private void onLauchModeChanged(LauchMode paramLauchMode)
  {
    String str1 = getIntent().getAction();
    if ((!sudroid.TextUtils.isEmptyOrBlank(str1)) && (str1.equals("android.intent.action.SEND")))
      paramLauchMode = LauchMode.SHARE;
    LauchMode localLauchMode;
    if (paramLauchMode == null)
    {
      localLauchMode = LauchMode.NEW_BLOG;
      this.mLauchMode = localLauchMode;
      onTitleChanged();
      int[] arrayOfInt = $SWITCH_TABLE$com$sina$weibo$EditActivity$LauchMode();
      int i = this.mLauchMode.ordinal();
      switch (arrayOfInt[i])
      {
      default:
      case 1:
      case 2:
      case 3:
      case 9:
      case 4:
      case 6:
      case 5:
      case 7:
      case 8:
      }
    }
    while (true)
    {
      return;
      localLauchMode = paramLauchMode;
      break;
      if (doesDraftExist())
      {
        showDialog(1009);
        continue;
      }
      loadShareImage();
      continue;
      String str2 = getIntent().getStringExtra("com.sina.weibo.intent.extra.INIT_TEXT");
      if (android.text.TextUtils.isEmpty(str2))
        continue;
      setEditText(str2);
      continue;
      str2 = getIntent().getStringExtra("android.intent.extra.TEXT");
      if (android.text.TextUtils.isEmpty(str2))
        continue;
      setEditText(str2);
      continue;
      initForwardLogic();
      continue;
      initCommentCommentLogic();
      continue;
      initSimpleCommentLogic();
      continue;
      initPrivateMessageLogic();
      continue;
      initFeedbackLogic();
    }
  }

  private void onTitleChanged()
  {
    String str1 = null;
    int[] arrayOfInt = $SWITCH_TABLE$com$sina$weibo$EditActivity$LauchMode();
    int i = this.mLauchMode.ordinal();
    switch (arrayOfInt[i])
    {
    default:
    case 1:
    case 2:
    case 3:
    case 9:
    case 4:
    case 5:
    case 6:
    case 7:
    case 8:
    }
    while (true)
    {
      String str2 = getString(2131427528);
      String str3 = getString(2131427650);
      setTitleBar(1, str2, str1, str3);
      return;
      str1 = getString(2131427649);
      continue;
      str1 = getString(2131427350);
      continue;
      str1 = getString(2131427351);
      continue;
      str1 = getString(2131427372);
      continue;
      str1 = getString(2131427330);
    }
  }

  private boolean processFinish()
  {
    LauchMode localLauchMode1 = this.mLauchMode;
    LauchMode localLauchMode2 = LauchMode.NEW_BLOG;
    if (localLauchMode1 == localLauchMode2)
      actionBeforeDestroy();
    while (true)
    {
      return true;
      finish();
    }
  }

  private void saveDraft()
  {
    if (this.mImageLoadingHelper.hasBitmap())
      boolean bool1 = this.mImageLoadingHelper.saveDraft();
    if (this.mLocationHelper.isLocatedSucess())
      boolean bool2 = this.mLocationHelper.saveDraft();
    String str = this.etMblog.getText().toString();
    if (!android.text.TextUtils.isEmpty(str))
      boolean bool3 = saveDraft(str);
    finish();
  }

  private boolean saveDraft(String paramString)
  {
    try
    {
      boolean bool = FileUtil.deleteDependon(this.DEFAULT_DRAFT_TEXT_PATH);
      FileUtil.makesureFileExist(this.DEFAULT_DRAFT_TEXT_PATH);
      String str = this.DEFAULT_DRAFT_TEXT_PATH;
      FileOutputStream localFileOutputStream = new FileOutputStream(str);
      FileUtil.saveObject(paramString, localFileOutputStream);
      Utils.logd("\t 存入文字缓存成功\n" + paramString);
      return false;
    }
    catch (Exception localException)
    {
      while (true)
        Utils.loge(localException);
    }
  }

  private void setEditText(String paramString)
  {
    SpannableString localSpannableString = new SpannableString(paramString);
    Utils.highlightContent(this, localSpannableString);
    EditText localEditText = this.etMblog;
    TextView.BufferType localBufferType = TextView.BufferType.SPANNABLE;
    localEditText.setText(localSpannableString, localBufferType);
  }

  private void startToCameraActivity()
  {
    if (FileUtil.hasSDCardMounted())
    {
      Intent localIntent1 = new Intent("android.media.action.IMAGE_CAPTURE");
      Uri localUri = Uri.fromFile(this.sdcardTempFile);
      Intent localIntent2 = localIntent1.putExtra("output", localUri);
      startActivityForResult(localIntent1, 101);
    }
    while (true)
    {
      return;
      Toast.makeText(this, 2131427598, 0).show();
    }
  }

  private void startToMediaActivity()
  {
    Uri localUri = MediaStore.Images.Media.INTERNAL_CONTENT_URI;
    Intent localIntent = new Intent("android.intent.action.PICK", localUri);
    startActivityForResult(localIntent, 100);
  }

  private void verifyCommentCommentIntent()
  {
    Intent localIntent = getIntent();
    if (android.text.TextUtils.isEmpty(localIntent.getStringExtra("com.sina.weibo.intent.extra.MBLOG_AUTHOR_UID")))
      throw new RuntimeException("回复评论需要原微博作者的uid");
    if (android.text.TextUtils.isEmpty(localIntent.getStringExtra("com.sina.weibo.intent.extra.MBLOG_ID")))
      throw new RuntimeException("回复评论需要原微博的id");
    if (android.text.TextUtils.isEmpty(localIntent.getStringExtra("com.sina.weibo.intent.extra.COMMENT_AUTHOR_UID")))
      throw new RuntimeException("回复评论需要原评论作者的id");
    if (android.text.TextUtils.isEmpty(localIntent.getStringExtra("com.sina.weibo.intent.extra.COMMENT_ID")))
      throw new RuntimeException("回复评论需要原评论的id");
  }

  private void verifyForwardIntent()
  {
    Intent localIntent = getIntent();
    if (android.text.TextUtils.isEmpty(localIntent.getStringExtra("com.sina.weibo.intent.extra.MBLOG_ID")))
      throw new RuntimeException("没有被转发的mblogid");
    if (android.text.TextUtils.isEmpty(localIntent.getStringExtra("com.sina.weibo.intent.extra.MBLOG_AUTHOR_UID")))
      throw new RuntimeException("没有被转发微博作者的uid");
    if ((!android.text.TextUtils.isEmpty(localIntent.getStringExtra("com.sina.weibo.intent.extra.FORWARD_REASON"))) && (android.text.TextUtils.isEmpty(localIntent.getStringExtra("com.sina.weibo.intent.extra.NICKNAME"))))
      throw new RuntimeException("如果包含转发理由的话应该含有该理由的作者的昵称");
  }

  private void verifyPrivateMessageIntent()
  {
    if (android.text.TextUtils.isEmpty(getIntent().getStringExtra("com.sina.weibo.intent.extra.NICKNAME")))
      throw new RuntimeException("回复某人私信需要改任的昵称");
  }

  private void verifySimpleCommentIntent()
  {
    Intent localIntent = getIntent();
    if (android.text.TextUtils.isEmpty(localIntent.getStringExtra("com.sina.weibo.intent.extra.MBLOG_ID")))
      throw new RuntimeException("评论微博需要微博的id");
    if (android.text.TextUtils.isEmpty(localIntent.getStringExtra("com.sina.weibo.intent.extra.MBLOG_AUTHOR_UID")))
      throw new RuntimeException("评论微博需要微博作者的uid");
  }

  public void afterTextChanged(Editable paramEditable)
  {
    int i = this.MAX_TEXT_LENGTH;
    int j = PostContentHelper.getContentLength(paramEditable.toString());
    int k = i - j;
    TextView localTextView = this.tvTextLimit;
    String str = String.valueOf(k);
    localTextView.setText(str);
  }

  public void beforeTextChanged(CharSequence paramCharSequence, int paramInt1, int paramInt2, int paramInt3)
  {
  }

  void cancleLocated()
  {
    Utils.logd("\t cancleLocated()");
    this.mLocationHelper.dispose();
    this.insertLocationView.setVisibility(8);
    this.pgLoadingLocation.setVisibility(8);
  }

  void displayFaceImageSrc()
  {
    if (this.ibFace != null)
      this.ibFace.setImageResource(2130837553);
  }

  void displayInsertBitmap()
  {
    ImageView localImageView1 = this.insertPicView;
    Bitmap localBitmap = this.mImageLoadingHelper.createThumbnail();
    localImageView1.setImageBitmap(localBitmap);
    this.insertPicView.setVisibility(0);
    ImageView localImageView2 = this.insertPicView;
    EditActivity.14 local14 = new EditActivity.14(this);
    localImageView2.setOnClickListener(local14);
  }

  void displayKeyboardImageSrc()
  {
    if (this.ibFace != null)
      this.ibFace.setImageResource(2130837554);
  }

  protected void handleTitleBarEvent(int paramInt)
  {
    int i = paramInt;
    int j = 1;
    if (i == j)
      boolean bool1 = processFinish();
    while (true)
    {
      return;
      if (paramInt == 0)
      {
        if (!checkTextLimit())
        {
          Toast.makeText(getApplicationContext(), 2131427740, 0).show();
          continue;
        }
      }
      else
        continue;
      int[] arrayOfInt = $SWITCH_TABLE$com$sina$weibo$EditActivity$LauchMode();
      int k = this.mLauchMode.ordinal();
      String str5;
      LocationHolder localLocationHolder;
      switch (arrayOfInt[k])
      {
      default:
        break;
      case 1:
      case 2:
      case 3:
      case 9:
        String str1 = this.etMblog.getText().toString().trim();
        int m = this.MAX_TEXT_LENGTH;
        String str2 = PostContentHelper.getTargetLengthString(str1, m);
        if ((!this.mImageLoadingHelper.hasBitmap()) && (android.text.TextUtils.isEmpty(str2)))
        {
          EditActivity localEditActivity1 = this;
          int n = 2131427475;
          String str3 = localEditActivity1.getString(n);
          EditActivity localEditActivity2 = this;
          String str4 = str3;
          int i1 = 0;
          Toast.makeText(localEditActivity2, str4, i1).show();
          continue;
        }
        if (this.mLocationHelper.isNeverLocated())
        {
          if (this.mImageLoadingHelper.hasBitmap());
          for (str5 = this.mImageLoadingHelper.getTempPath(); ; str5 = null)
          {
            PostContentHelper localPostContentHelper1 = this.mPostContentHelper;
            User localUser1 = StaticInfo.mUser;
            localPostContentHelper1.execPostNewBlogTask(localUser1, str2, str5);
            break;
          }
        }
        boolean bool2 = this.mLocationHelper.isFetching();
        if (!this.mLocationHelper.isLocatedSucess())
          continue;
        localLocationHolder = this.mLocationHelper.getLocationHolder();
        if (this.mImageLoadingHelper.hasBitmap());
        for (str5 = this.mImageLoadingHelper.getTempPath(); ; str5 = null)
        {
          PostContentHelper localPostContentHelper2 = this.mPostContentHelper;
          User localUser2 = StaticInfo.mUser;
          double d1 = localLocationHolder.lat;
          double d2 = localLocationHolder.lon;
          localPostContentHelper2.execPostNewBlogTask(localUser2, str2, str5, d1, d2);
          break;
        }
      case 4:
        PostContentHelper localPostContentHelper3 = this.mPostContentHelper;
        User localUser3 = StaticInfo.mUser;
        localPostContentHelper3.execForwardBlogTask(localUser3);
        break;
      case 6:
        if (android.text.TextUtils.isEmpty(this.etMblog.getText().toString().trim()))
        {
          EditActivity localEditActivity3 = this;
          int i2 = 2131427475;
          String str6 = localEditActivity3.getString(i2);
          EditActivity localEditActivity4 = this;
          String str7 = str6;
          int i3 = 0;
          Toast.makeText(localEditActivity4, str7, i3).show();
          continue;
        }
        PostContentHelper localPostContentHelper4 = this.mPostContentHelper;
        User localUser4 = StaticInfo.mUser;
        localPostContentHelper4.execCommentCommentTask(localUser4);
        break;
      case 5:
        if (android.text.TextUtils.isEmpty(this.etMblog.getText().toString().trim()))
        {
          EditActivity localEditActivity5 = this;
          int i4 = 2131427475;
          String str8 = localEditActivity5.getString(i4);
          EditActivity localEditActivity6 = this;
          String str9 = str8;
          int i5 = 0;
          Toast.makeText(localEditActivity6, str9, i5).show();
          continue;
        }
        PostContentHelper localPostContentHelper5 = this.mPostContentHelper;
        User localUser5 = StaticInfo.mUser;
        localPostContentHelper5.execSimpleCommentTask(localUser5);
        break;
      case 7:
        if (android.text.TextUtils.isEmpty(this.etMblog.getText().toString().trim()))
        {
          EditActivity localEditActivity7 = this;
          int i6 = 2131427475;
          String str10 = localEditActivity7.getString(i6);
          EditActivity localEditActivity8 = this;
          String str11 = str10;
          int i7 = 0;
          Toast.makeText(localEditActivity8, str11, i7).show();
          continue;
        }
        PostContentHelper localPostContentHelper6 = this.mPostContentHelper;
        User localUser6 = StaticInfo.mUser;
        localPostContentHelper6.execPrivateMsgTask(localUser6);
        break;
      case 8:
        StringBuilder localStringBuilder1 = new StringBuilder();
        StringBuilder localStringBuilder2 = localStringBuilder1;
        String str12 = "@";
        StringBuilder localStringBuilder3 = localStringBuilder2.append(str12);
        EditActivity localEditActivity9 = this;
        int i8 = 2131427639;
        String str13 = localEditActivity9.getString(i8);
        StringBuilder localStringBuilder4 = localStringBuilder3.append(str13).append(" ");
        StringBuilder localStringBuilder5 = localStringBuilder1;
        String str14 = "#";
        StringBuilder localStringBuilder6 = localStringBuilder5.append(str14);
        EditActivity localEditActivity10 = this;
        int i9 = 2131427331;
        String str15 = localEditActivity10.getString(i9);
        StringBuilder localStringBuilder7 = localStringBuilder6.append(str15).append("#");
        StringBuilder localStringBuilder8 = localStringBuilder1;
        String str16 = "#";
        StringBuilder localStringBuilder9 = localStringBuilder8.append(str16);
        String str17 = WeiboApplication.DEVICE_NAME;
        StringBuilder localStringBuilder10 = localStringBuilder9.append(str17).append("#");
        StringBuilder localStringBuilder11 = localStringBuilder1;
        String str18 = "#";
        StringBuilder localStringBuilder12 = localStringBuilder11.append(str18);
        String str19 = WeiboApplication.HARDWARE_VERSION;
        StringBuilder localStringBuilder13 = localStringBuilder12.append(str19).append("#");
        NetworkUtil.NetworkState localNetworkState1 = NetworkUtil.getNetworkState(getApplicationContext());
        NetworkUtil.NetworkState localNetworkState2 = NetworkUtil.NetworkState.NOTHING;
        NetworkUtil.NetworkState localNetworkState3 = localNetworkState1;
        NetworkUtil.NetworkState localNetworkState4 = localNetworkState2;
        String str20;
        if (localNetworkState3 == localNetworkState4)
        {
          str20 = "No network connection";
          label855: StringBuilder localStringBuilder14 = localStringBuilder1;
          String str21 = "#";
          StringBuilder localStringBuilder15 = localStringBuilder14.append(str21);
          String str22 = str20;
          StringBuilder localStringBuilder16 = localStringBuilder15.append(str22).append("#");
        }
        try
        {
          PackageManager localPackageManager1 = getPackageManager();
          String str23 = getPackageName();
          PackageManager localPackageManager2 = localPackageManager1;
          String str24 = str23;
          int i10 = 0;
          PackageInfo localPackageInfo = localPackageManager2.getPackageInfo(str24, i10);
          StringBuilder localStringBuilder17 = localStringBuilder1;
          String str25 = "#";
          StringBuilder localStringBuilder18 = localStringBuilder17.append(str25);
          String str26 = localPackageInfo.versionName;
          StringBuilder localStringBuilder19 = localStringBuilder18.append(str26).append("#");
          label966: StringBuilder localStringBuilder20 = localStringBuilder1;
          String str27 = " ";
          StringBuilder localStringBuilder21 = localStringBuilder20.append(str27);
          String str28 = this.etMblog.getText().toString().trim();
          String str29 = str28;
          int i11 = this.MAX_TEXT_LENGTH;
          String str30 = PostContentHelper.getTargetLengthString(str29, i11);
          if ((!this.mImageLoadingHelper.hasBitmap()) && (android.text.TextUtils.isEmpty(str30)))
          {
            EditActivity localEditActivity11 = this;
            int i12 = 2131427475;
            String str31 = localEditActivity11.getString(i12);
            EditActivity localEditActivity12 = this;
            String str32 = str31;
            int i13 = 0;
            Toast.makeText(localEditActivity12, str32, i13).show();
            continue;
            NetworkUtil.NetworkState localNetworkState5 = NetworkUtil.NetworkState.WIFI;
            NetworkUtil.NetworkState localNetworkState6 = localNetworkState1;
            NetworkUtil.NetworkState localNetworkState7 = localNetworkState5;
            if (localNetworkState6 == localNetworkState7)
            {
              str20 = "Wifi";
              break label855;
            }
            NetworkUtil.APNWrapper localAPNWrapper = NetworkUtil.getAPN(getApplicationContext());
            if (localAPNWrapper != null)
            {
              str20 = localAPNWrapper.apn;
              break label855;
            }
            str20 = "UNKNOWEN APN";
            break label855;
          }
          if (this.mLocationHelper.isNeverLocated())
          {
            if (this.mImageLoadingHelper.hasBitmap());
            for (str5 = this.mImageLoadingHelper.getTempPath(); ; str5 = null)
            {
              PostContentHelper localPostContentHelper7 = this.mPostContentHelper;
              User localUser7 = StaticInfo.mUser;
              localPostContentHelper7.execPostNewBlogTask(localUser7, str30, str5);
              break;
            }
          }
          boolean bool3 = this.mLocationHelper.isFetching();
          if (!this.mLocationHelper.isLocatedSucess())
            continue;
          localLocationHolder = this.mLocationHelper.getLocationHolder();
          if (this.mImageLoadingHelper.hasBitmap());
          for (str5 = this.mImageLoadingHelper.getTempPath(); ; str5 = null)
          {
            PostContentHelper localPostContentHelper8 = this.mPostContentHelper;
            User localUser8 = StaticInfo.mUser;
            double d3 = localLocationHolder.lat;
            double d4 = localLocationHolder.lon;
            String str33 = str5;
            localPostContentHelper8.execPostNewBlogTask(localUser8, str30, str33, d3, d4);
            break;
          }
        }
        catch (Exception localException)
        {
          break label966;
        }
      }
    }
  }

  protected void loadShareImage()
  {
    Uri localUri = (Uri)getIntent().getParcelableExtra("android.intent.extra.STREAM");
    if (localUri != null)
      displayImageUri(localUri);
  }

  protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    String str = String.valueOf(EditActivity.class.getSimpleName());
    Utils.logd(str + "\tonActivityResult()" + "\n" + "\trequestCode:" + paramInt1 + "\tresultCode:" + paramInt2);
    if ((paramInt1 == 101) || (100 == paramInt1))
      if (paramInt2 == -1);
    while (true)
    {
      return;
      Uri localUri = null;
      if ((paramInt1 == 101) && (FileUtil.doesExisted(this.sdcardTempFile)))
        localUri = Uri.fromFile(this.sdcardTempFile);
      while (true)
      {
        if (localUri == null)
          break label131;
        displayImageUri(localUri);
        break;
        if (100 != paramInt1)
          continue;
        localUri = paramIntent.getData();
      }
      label131: continue;
      if (paramInt1 != 102)
        continue;
      displayInsertBitmap();
    }
  }

  public void onClick(View paramView)
  {
    super.onClick(paramView);
    switch (paramView.getId())
    {
    case 2131624084:
    case 2131624085:
    case 2131624086:
    case 2131624087:
    case 2131624089:
    default:
    case 2131624083:
    case 2131624090:
    case 2131624080:
    case 2131624079:
    case 2131624081:
    case 2131624082:
    case 2131624088:
    }
    while (true)
    {
      return;
      this.mFaceClickHealper.onClick(paramView);
      continue;
      if (!this.mFaceClickHealper.isFaceDiaplay())
        continue;
      this.mFaceClickHealper.onClick(paramView);
      continue;
      if (this.mImageLoadingHelper.hasBitmap())
      {
        showDialog(1002);
        continue;
      }
      showDialog(1001);
      continue;
      if ((this.mLocationHelper.isFetching()) || (this.mLocationHelper.isLocatedSucess()))
      {
        cancleLocated();
        continue;
      }
      this.mLocationHelper.openAllProviders();
      continue;
      this.mTopicHelper.appendText();
      continue;
      this.mAtEditHelper.appendText();
      continue;
      showDialog(1010);
    }
  }

  public void onConfigurationChanged(Configuration paramConfiguration)
  {
    super.onConfigurationChanged(paramConfiguration);
    this.mEmotionView.reBuildViews();
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    InputMethodManager localInputMethodManager = (InputMethodManager)getSystemService("input_method");
    this.mInputMethodManager = localInputMethodManager;
    String str1 = String.valueOf(getFilesDir().getAbsolutePath());
    String str2 = str1 + "/draft/text.dat";
    this.DEFAULT_DRAFT_TEXT_PATH = str2;
    boolean bool = requestWindowFeature(1);
    Display localDisplay = getWindowManager().getDefaultDisplay();
    int i = localDisplay.getWidth();
    int j = localDisplay.getHeight();
    WeiboApplication.setDisplay(i, j);
    setView(2130903067);
    LocationHelper localLocationHelper = new LocationHelper(this);
    this.mLocationHelper = localLocationHelper;
    ImageLoadingHelper localImageLoadingHelper = new ImageLoadingHelper(this);
    this.mImageLoadingHelper = localImageLoadingHelper;
    FaceClickHealper localFaceClickHealper = new FaceClickHealper(this);
    this.mFaceClickHealper = localFaceClickHealper;
    AtEditHelper localAtEditHelper = new AtEditHelper(this);
    this.mAtEditHelper = localAtEditHelper;
    TopicHelper localTopicHelper = new TopicHelper(this);
    this.mTopicHelper = localTopicHelper;
    PostContentHelper localPostContentHelper = new PostContentHelper(this);
    this.mPostContentHelper = localPostContentHelper;
    EditText localEditText = (EditText)findViewById(2131624090);
    this.etMblog = localEditText;
    this.etMblog.setOnClickListener(this);
    this.etMblog.addTextChangedListener(this);
    ImageButton localImageButton1 = (ImageButton)findViewById(2131624083);
    this.ibFace = localImageButton1;
    this.ibFace.setOnClickListener(this);
    EmotionView localEmotionView1 = (EmotionView)findViewById(2131624091);
    this.mEmotionView = localEmotionView1;
    EmotionView localEmotionView2 = this.mEmotionView;
    EmotionView.EmotionAdapter localEmotionAdapter = this.mEmotionAdapter;
    localEmotionView2.setEmotionAdapter(localEmotionAdapter);
    ImageView localImageView1 = (ImageView)findViewById(2131624085);
    this.insertPicView = localImageView1;
    ImageView localImageView2 = (ImageView)findViewById(2131624086);
    this.insertLocationView = localImageView2;
    ProgressBar localProgressBar = (ProgressBar)findViewById(2131624087);
    this.pgLoadingLocation = localProgressBar;
    TextView localTextView = (TextView)findViewById(2131624089);
    this.tvTextLimit = localTextView;
    CheckBox localCheckBox = (CheckBox)findViewById(2131624077);
    this.cbCommentSameTime = localCheckBox;
    ImageButton localImageButton2 = (ImageButton)findViewById(2131624080);
    this.ibInsertPic = localImageButton2;
    this.ibInsertPic.setOnClickListener(this);
    ImageButton localImageButton3 = (ImageButton)findViewById(2131624079);
    this.ibInsertLocation = localImageButton3;
    this.ibInsertLocation.setOnClickListener(this);
    View localView1 = findViewById(2131624076);
    this.llOperationExtraLayout = localView1;
    View localView2 = this.llOperationExtraLayout;
    EditActivity.2 local2 = new EditActivity.2(this);
    localView2.setOnClickListener(local2);
    findViewById(2131624088).setOnClickListener(this);
    findViewById(2131624081).setOnClickListener(this);
    findViewById(2131624082).setOnClickListener(this);
    File localFile1 = Environment.getExternalStorageDirectory();
    StringBuilder localStringBuilder = new StringBuilder("tmp_bmp_");
    long l = SystemClock.currentThreadTimeMillis();
    String str3 = l + ".jpg";
    File localFile2 = new File(localFile1, str3);
    this.sdcardTempFile = localFile2;
    LauchMode localLauchMode = (LauchMode)getIntent().getSerializableExtra("com.sina.weibo.intent.extra.LAUCH_MODE");
    onLauchModeChanged(localLauchMode);
  }

  protected Dialog onCreateDialog(int paramInt)
  {
    Object localObject = null;
    if (paramInt == 1000)
    {
      AlertDialog.Builder localBuilder1 = new AlertDialog.Builder(this).setTitle(2131427359);
      String str1 = getString(2131427567);
      AlertDialog.Builder localBuilder2 = localBuilder1.setMessage(str1);
      EditActivity.3 local3 = new EditActivity.3(this);
      localObject = localBuilder2.setPositiveButton(2131427441, local3).create();
    }
    while (true)
    {
      return localObject;
      if (paramInt == 1001)
      {
        AlertDialog.Builder localBuilder3 = new AlertDialog.Builder(this).setTitle(2131427359);
        CharSequence[] arrayOfCharSequence1 = new CharSequence[2];
        String str2 = getString(2131427363);
        arrayOfCharSequence1[0] = str2;
        String str3 = getString(2131427364);
        arrayOfCharSequence1[1] = str3;
        EditActivity.4 local4 = new EditActivity.4(this);
        localObject = localBuilder3.setItems(arrayOfCharSequence1, local4).create();
        continue;
      }
      if (paramInt == 1002)
      {
        AlertDialog.Builder localBuilder4 = new AlertDialog.Builder(this).setTitle(2131427359);
        CharSequence[] arrayOfCharSequence2 = new CharSequence[3];
        String str4 = getString(2131427363);
        arrayOfCharSequence2[0] = str4;
        String str5 = getString(2131427364);
        arrayOfCharSequence2[1] = str5;
        String str6 = getString(2131427527);
        arrayOfCharSequence2[2] = str6;
        EditActivity.5 local5 = new EditActivity.5(this);
        localObject = localBuilder4.setItems(arrayOfCharSequence2, local5).create();
        continue;
      }
      if (paramInt == 1007)
      {
        AlertDialog.Builder localBuilder5 = new AlertDialog.Builder(this).setTitle(2131427595).setMessage(2131427736);
        EditActivity.6 local6 = new EditActivity.6(this);
        AlertDialog.Builder localBuilder6 = localBuilder5.setPositiveButton(2131427441, local6);
        EditActivity.7 local7 = new EditActivity.7(this);
        localObject = localBuilder6.setNegativeButton(2131427436, local7).create();
        continue;
      }
      if (paramInt == 1008)
      {
        AlertDialog.Builder localBuilder7 = new AlertDialog.Builder(this).setTitle(2131427595).setMessage(2131427737);
        EditActivity.8 local8 = new EditActivity.8(this);
        AlertDialog.Builder localBuilder8 = localBuilder7.setPositiveButton(2131427441, local8);
        EditActivity.9 local9 = new EditActivity.9(this);
        localObject = localBuilder8.setNegativeButton(2131427436, local9).create();
        continue;
      }
      if (paramInt == 1009)
      {
        AlertDialog.Builder localBuilder9 = new AlertDialog.Builder(this).setTitle(2131427595).setMessage(2131427738);
        EditActivity.10 local10 = new EditActivity.10(this);
        AlertDialog.Builder localBuilder10 = localBuilder9.setPositiveButton(2131427441, local10);
        EditActivity.11 local11 = new EditActivity.11(this);
        AlertDialog.Builder localBuilder11 = localBuilder10.setNegativeButton(2131427436, local11);
        EditActivity.12 local12 = new EditActivity.12(this);
        localObject = localBuilder11.setNeutralButton(2131427514, local12).setCancelable(0).create();
        continue;
      }
      if (paramInt == 1010)
      {
        AlertDialog.Builder localBuilder12 = new AlertDialog.Builder(this).setTitle(2131427595).setMessage(2131427741);
        EditActivity.13 local13 = new EditActivity.13(this);
        localObject = localBuilder12.setPositiveButton(2131427441, local13).setNegativeButton(2131427436, null).create();
        continue;
      }
      if ((paramInt == 1003) || (paramInt == 1005))
      {
        localObject = Utils.createProgressDialog(2131427425, this, -1);
        continue;
      }
      if (paramInt == 1004)
      {
        localObject = Utils.createProgressDialog(2131427426, this, -1);
        continue;
      }
      if (paramInt != 1006)
        continue;
      localObject = Utils.createProgressDialog(2131427427, this, -1);
    }
  }

  protected void onDestroy()
  {
    boolean bool = FileUtil.deleteDependon(this.sdcardTempFile);
    this.mImageLoadingHelper.reset();
    this.mLocationHelper.dispose();
    super.onDestroy();
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    int i;
    if (paramInt == 4)
      if (this.mFaceClickHealper.onFinish())
        i = 1;
    while (true)
    {
      return i;
      boolean bool = processFinish();
      continue;
      bool = super.onKeyDown(paramInt, paramKeyEvent);
    }
  }

  void onLocatedError()
  {
    Utils.logd("\t onLocatedError()");
    this.insertLocationView.setVisibility(8);
    this.pgLoadingLocation.setVisibility(8);
    Toast.makeText(this, 2131427641, 0).show();
  }

  void onLocatedSuccess()
  {
    Utils.logd("\t onLocatedSuccess()");
    this.pgLoadingLocation.setVisibility(8);
    this.insertLocationView.setVisibility(0);
    StringBuilder localStringBuilder = new StringBuilder();
    LocationHolder localLocationHolder = this.mLocationHelper.getLocationHolder();
    Utils.logd(localLocationHolder);
  }

  void onLocatedSuccess(LocationHolder paramLocationHolder)
  {
    onLocatedSuccess();
    EditText localEditText = this.etMblog;
    StringBuilder localStringBuilder = new StringBuilder(" ");
    Object[] arrayOfObject = new Object[2];
    Double localDouble1 = Double.valueOf(paramLocationHolder.lat);
    arrayOfObject[0] = localDouble1;
    Double localDouble2 = Double.valueOf(paramLocationHolder.lon);
    arrayOfObject[1] = localDouble2;
    String str1 = getString(2131427597, arrayOfObject);
    String str2 = str1 + " ";
    localEditText.append(str2);
  }

  void onPostError()
  {
    String str = "";
    int[] arrayOfInt = $SWITCH_TABLE$com$sina$weibo$EditActivity$LauchMode();
    int i = this.mLauchMode.ordinal();
    switch (arrayOfInt[i])
    {
    default:
    case 1:
    case 2:
    case 3:
    case 8:
    case 9:
    case 5:
    case 6:
    case 4:
    case 7:
    }
    while (true)
    {
      dismissDialogs();
      Toast.makeText(this, str, 0).show();
      if (this.mFaceClickHealper.isFaceDiaplay())
        boolean bool = this.mFaceClickHealper.onFinish();
      return;
      str = getString(2131427477);
      continue;
      str = getString(2131427479);
      continue;
      str = getString(2131427669);
      continue;
      str = getString(2131427481);
    }
  }

  public void onPostError(Throwable paramThrowable)
  {
    if (!(Utils.getRootCause(paramThrowable) instanceof RPCHelper.ApiException))
      onPostError();
    while (true)
    {
      return;
      String str = Utils.translationThrowable(getApplicationContext(), paramThrowable);
      Toast.makeText(this, str, 0).show();
      dismissDialogs();
      if (!this.mFaceClickHealper.isFaceDiaplay())
        continue;
      boolean bool = this.mFaceClickHealper.onFinish();
    }
  }

  void onPostExecute()
  {
    String str = "";
    int[] arrayOfInt = $SWITCH_TABLE$com$sina$weibo$EditActivity$LauchMode();
    int i = this.mLauchMode.ordinal();
    switch (arrayOfInt[i])
    {
    default:
    case 1:
    case 2:
    case 3:
    case 8:
    case 9:
    case 4:
    case 5:
    case 6:
    case 7:
    }
    while (true)
    {
      Toast.makeText(this, str, 0).show();
      finish();
      return;
      str = getString(2131427476);
      if (!this.usingDraft)
        continue;
      boolean bool = deleteDraft();
      this.usingDraft = 0;
      continue;
      str = getString(2131427668);
      continue;
      str = getString(2131427478);
      continue;
      str = getString(2131427480);
    }
  }

  void onPreExecute()
  {
    int[] arrayOfInt = $SWITCH_TABLE$com$sina$weibo$EditActivity$LauchMode();
    int i = this.mLauchMode.ordinal();
    switch (arrayOfInt[i])
    {
    default:
    case 1:
    case 2:
    case 3:
    case 8:
    case 9:
    case 5:
    case 6:
    case 4:
    case 7:
    }
    while (true)
    {
      if (this.mFaceClickHealper.isFaceDiaplay())
        boolean bool = this.mFaceClickHealper.onFinish();
      return;
      showDialog(1003);
      continue;
      showDialog(1004);
      continue;
      showDialog(1005);
      continue;
      showDialog(1006);
    }
  }

  protected void onResume()
  {
    super.onResume();
    if (this.mFaceClickHealper.isFaceDiaplay())
      boolean bool = this.mFaceClickHealper.onFinish();
  }

  public void onTextChanged(CharSequence paramCharSequence, int paramInt1, int paramInt2, int paramInt3)
  {
  }

  void setEmotionViewVisibility(boolean paramBoolean)
  {
    EmotionView localEmotionView;
    if (this.mEmotionView != null)
    {
      localEmotionView = this.mEmotionView;
      if (!paramBoolean)
        break label24;
    }
    label24: for (int i = 0; ; i = 8)
    {
      localEmotionView.setVisibility(i);
      return;
    }
  }

  boolean setInputMethodVisibility(boolean paramBoolean)
  {
    if ((this.mInputMethodManager != null) && (this.etMblog != null))
    {
      if (!paramBoolean)
        break label38;
      InputMethodManager localInputMethodManager1 = this.mInputMethodManager;
      EditText localEditText1 = this.etMblog;
      boolean bool1 = localInputMethodManager1.showSoftInput(localEditText1, 0);
    }
    while (true)
    {
      return false;
      label38: InputMethodManager localInputMethodManager2 = this.mInputMethodManager;
      EditText localEditText2 = this.etMblog;
      if (!localInputMethodManager2.isActive(localEditText2))
        continue;
      InputMethodManager localInputMethodManager3 = this.mInputMethodManager;
      IBinder localIBinder = this.etMblog.getWindowToken();
      boolean bool2 = localInputMethodManager3.hideSoftInputFromWindow(localIBinder, 2);
    }
  }

  public enum LauchMode
  {
    static
    {
      AT = new LauchMode("AT", 2);
      FORWARD = new LauchMode("FORWARD", 3);
      SIMPLE_COMMENT = new LauchMode("SIMPLE_COMMENT", 4);
      COMMENT_COMMENT = new LauchMode("COMMENT_COMMENT", 5);
      PRIVATE_MESSAGE = new LauchMode("PRIVATE_MESSAGE", 6);
      FEEDBACK = new LauchMode("FEEDBACK", 7);
      SHARE = new LauchMode("SHARE", 8);
      LauchMode[] arrayOfLauchMode = new LauchMode[9];
      LauchMode localLauchMode1 = NEW_BLOG;
      arrayOfLauchMode[0] = localLauchMode1;
      LauchMode localLauchMode2 = TOPIC;
      arrayOfLauchMode[1] = localLauchMode2;
      LauchMode localLauchMode3 = AT;
      arrayOfLauchMode[2] = localLauchMode3;
      LauchMode localLauchMode4 = FORWARD;
      arrayOfLauchMode[3] = localLauchMode4;
      LauchMode localLauchMode5 = SIMPLE_COMMENT;
      arrayOfLauchMode[4] = localLauchMode5;
      LauchMode localLauchMode6 = COMMENT_COMMENT;
      arrayOfLauchMode[5] = localLauchMode6;
      LauchMode localLauchMode7 = PRIVATE_MESSAGE;
      arrayOfLauchMode[6] = localLauchMode7;
      LauchMode localLauchMode8 = FEEDBACK;
      arrayOfLauchMode[7] = localLauchMode8;
      LauchMode localLauchMode9 = SHARE;
      arrayOfLauchMode[8] = localLauchMode9;
      ENUM$VALUES = arrayOfLauchMode;
    }
  }
}

/* Location:           D:\Program Files\eclipse\apktool-r01-3\新浪微博\classes.dex.dex2jar.jar
 * Qualified Name:     com.sina.weibo.EditActivity
 * JD-Core Version:    0.6.0
 */